package com.realbrand.net.realbrandpay.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.realbrand.net.realbrandpay.R;
import com.realbrand.net.realbrandpay.bean.LogisticTwoBean;

import java.util.List;

/**
 * Created by Administrator on 2018/9/12.
 */

public class LogisticTwoAdapter extends BaseAdapter {
    List<LogisticTwoBean> data;
    Context context;
    LayoutInflater inflater;

    public LogisticTwoAdapter(List<LogisticTwoBean> data, Context context) {
        this.data = data;
        this.context = context;
        inflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public Object getItem(int position) {
        return data.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        LogisticTwoViewHoler holer;
        if (convertView == null) {
            convertView = inflater.inflate(R.layout.item_logistic_two_lv, parent, false);
            holer = new LogisticTwoViewHoler(convertView);
            convertView.setTag(holer);
        } else {
            holer = (LogisticTwoViewHoler) convertView.getTag();
        }
        holer.tv_time.setText(data.get(position).getAcceptTime());
        holer.tv_info.setText(data.get(position).getAcceptStation());
        return convertView;
    }

    class LogisticTwoViewHoler {
        TextView tv_time;
        TextView tv_info;

        public LogisticTwoViewHoler(View view) {
            tv_time = (TextView) view.findViewById(R.id.logistic_two_item_tv_time);
            tv_info = (TextView) view.findViewById(R.id.logistic_two_item_tv_info);
        }
    }
}
